The original image of downtown Berekeley was taken during a sunny day. Given the sensor does not have the dynamic range to account for the brightness differential in the image, there are overpronounced shadows in the image. The goal of this project was to produce an image that looked like it was taken on a cloudy day.
Naturally, a cloudy day has even lighting across a scene. As such, I implemented the histogram equalization function explicitly coded in Problem 2. From here, I incorporated a gamma correction function to further fine tune the image's brightness distribution without having to clip and thereby lose information. A γ value of .6 was used in order to further brighten the shadow of the building.
Finally, I implemented a slight highboost filtering, defined in Problem 3 to improve the perceived sharpness of the image.
The histograms for these figures are shown below. We can see a more even distribution of intensities upon performing histogram equalization, and the distribution center-of-mass shifted slightly right upon gamma correction (corresponding to an increase in brightness).
The relative intensity of black and white pixels increases upon highboost sharpening because these areas usually correspond to edges which are being enhanced, and thus the rest of the histogram looks squashed as a result of scaling.
Upon histogram equalizing spillway-dark, we see signifcantly more detail in the shadowed regions. This is most prominent in the rocks and trees. The image was originally capped at a brightness of 140, which did not take advantage of the full 8-bit image depth. Equalizing the histogram therefore increases the intensity difference between pixels, which makes the detail more apparent in the image.
The histogram shows a more right-weighted distribution after the equalization.
After applying the equalization, we reveal a lot of detail in the previously black background, including a figure of a horse. We have also, however, increased the prevalance of the noise, leading to a much grainier image.
Similar to Fig. 3.25(c), this is a demonstration of when global histogram equalization is an innapropriate transformation to apply to an image. Because a large proportion of the image in reality is black, equalizing the histogram creates a washed out look.
The function used to apply the gaussian filter is defined below.
Using the gaussian kernal from (a) seems to work just fine for this purpose. When taking the negative (255 - pixel intensities), we see the blur corresponding to the top right square is significantly brighter than any other part of the image.
We threshold this image by taking all the pixels brighter than 120 on the negative image, and then invert this to produce the final thresholded image.
The gaussian kernal size is selected to be 5x the sigma selected. This is done in order to nicely crop the gaussian distribution such that no part is cut off nor are there excess 0 values. The size of a single box is 64 pixels. Therefore, we iterate through sigma values equal to multiples of $\frac{64}{5}$. Each one of these kernals would therefore cover 1, 2, 3, 4, ...etc squares when centered.
In order to speed up computation time, we take advantage of the fact that convolutions are separable. Rather than applying larger and larger filters to the original image, we iteratively perform gaussian convolution where $\sigma = \frac{64}{5}$.
We can see that $\sigma = 51.2$, which corresponds to a kernal covering 4 squares in both dimensions produces the smooth results seen in Example 3.18.
The function used to apply unsharp masking with a gaussian function is detailed below:
A laplacian filter is an approximation of a gaussian filtered image subtracted from the original. Because convolutions are separable, a laplacian operator can be applied directly to a regular image to produce the high frequency components and be approximately equivalent to the 2 step process undergone in 3.8(a).
While both the result from laplacian filter and the result from 3.8(a) look sharper relative to the original blurry-moon image, the 3.8(a) result is sharper because the gaussian kernal I selected obfuscated more high frequency components than the laplacian kernal provide in the book. Therefore, more high frequency components were included in the edge map produced in 3.8(a) than from this laplacian operation, thereby producing a slighlty sharper image.
The Sobel operator in 3.56(d) contains non-zero entries on the center rows. When the convolution is transposed, this kernal will be transposed such that the non-zero entries will be on the center column. The values on the top row are on the negative of the bottom row. The Sobel opperation will take a differnce within a path. Therefore, this kernel with approximate the differential along the x-axis. Thus, vertical lines are produced along the edges of the square upon a color transition. The values are positive (white) when transitioning from white to black and negative (black) when transitiong from black to white.
Similarly, when the Sobel operator in 3.56(e) is applied, the differential along the y-axis is taken, resuling in horizontal lines upon the color transition.
Applying both kernals to the image results in this dot like pattern. This represents the global gradients of the image. The dot pattern arises because the only areas where there is both a vertical and horizontal transition is at the corners of the squares.
Below is the magnitude of the gradient of the image. It is calculared via $ \sqrt{Image_{Dx}^2 + Image_{Dy}^2} $. The white lines only exist along the edges of the squares. The interiors are black because each square is a constant color. This indicates that this shade is not a higher resolution layer atop the image, but rather an optical illusion created by gradually brightening the intensity of the white squares along the diagonal.
It generally increases along the diagonal following the shade. This is because there is not as large difference between adjacent pixels within the shaded region as in the non-shaded region. The gradient magnitude gradually increases as the shade tapers off.